<?php

namespace App\Transformers\Shipping;

use App\Models\ShippingTemplatesFree;
use League\Fractal\TransformerAbstract;

class ShippingTemplatesFreeTransformer extends TransformerAbstract
{
    public function transform(ShippingTemplatesFree $data){
        return [
            'id' => $data->id,
            'province_id' => $data->province_id ?? '',
            'temp_id' => $data->temp_id ?? '',
            'city_id' => $data->city_id ?? '',
            'number' => $data->number ?? '',
            'price' => $data->price ?? '',
            'type' => $data->typeLet[$data->type] ?? '',
            'uniqid' => $data->uniqid ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }

}
